function dist = ComputeHausDist( tarX, tarY, ptsX, ptsY )
dbstop if error
% compute a modified hausdorff distance between two points
% sets in euclidean space

% d = average of  min( distance from x in tarX, tarY to {ptsX,ptsY}

% sum over observed points
dist = 0;
for k = 1:length(tarX)
    
    xx = repmat( tarX(k), length(ptsX), 1);
    yy = repmat( tarY(k), length(ptsX), 1);
    
    alldist = sqrt( (xx - ptsX).^2 + (yy-ptsY).^2 );
    dmin = min(alldist);
    dist = dist+dmin;
    
    
end;

dist = dist / length(tarX);
